import React from 'react'
// ===================================================================== Temp
import TableModal from '#cpt/temp/TableModal'
// ===================================================================== Declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const Export = $Lazy.file(()=>import('#private/common/export'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		forms : [
			{ label: '条码号',		name: 'spec_code' },
			{ label: '病人姓名',		name: 'patient_name' },
		]
	}
	
	model = {}
	
	open = ({ project_id, parent_kind_id, kind_id, start_at, end_at, bill_start_at, bill_end_at }) => {
		this.modal.open()
		this.query = { project_id, parent_kind_id, kind_id, start_at, end_at, bill_start_at, bill_end_at }
		// 阻止重复加载数据
		this.fetch()
	}
	
	// paging
	fetch = () => $fn.fetch.call(this, 'statistics/labSingleTestResultDetail')
	
	// 表单
	cols = [
		{ title: '岗位', 				dataIndex: 'project_name', 			width:150 },
		{ title: '接收时间', 			dataIndex: 'check_time', 			...$fn.table.time },
		// { title: '账单时间', 			dataIndex: 'created_at', 			...$fn.table.time },
		{ title: '客户名称', 			dataIndex: 'hosp_name', 			width:150 },
		{ title: '条码号', 				dataIndex: 'old_spec_code',			...$fn.table.spec_code },
		{ title: '自然项目', 			dataIndex: 'parent_kind_name', 		width:150 },
		{ title: '项目名称', 			dataIndex: 'kind_name', 			width:150 },
		// { title: '标准价格', 			dataIndex: 'sprice', 				...$fn.table.num },
		// { title: '实际价格', 			dataIndex: 'price', 				...$fn.table.num },
		{ title: '姓名', 				dataIndex: 'patient_name', 			...$fn.table.name },
		{ title: '性别', 				dataIndex: 'sex_name', 				...$fn.table.sex },
		{ title: '年龄', 				dataIndex: 'age', 					...$fn.table.age },
		{ title: '送检科室', 			dataIndex: 'department_name', 		width:150 },
		{ title: '医生', 				dataIndex: 'doctor', 				...$fn.table.name },
		{ title: '备注', 				dataIndex: 'remark', 				width:150 },
		// { title: '账单属性', 			dataIndex: 'attribute_name', 			width:150 },
		{ title: '实验科室', 			dataIndex: 'project_parent_name', 	width:100 },
		{ title: '开票单位（NC）', 		dataIndex: 'organization_name', 	width:150 },
		{ title: '开票单位编码（NC）', 	dataIndex: 'organization_code', 	width:150 },
		{ title: '业务员', 				dataIndex: 'salesman_user', 		...$fn.table.name },
		{ title: '业务员编码', 			dataIndex: 'salesman_code', 		width:100 },
		{ title: '区域', 				dataIndex: 'region_name', 			width:100 },
		{ title: '区域编码', 			dataIndex: 'region_num', 			width:100 },
	]
	
	render(){
		return TableModal.call(this,{ title: '项目明细', labelWidth:'s7', width:'90%', height:'80%', okText:'导出',
			onOk:()=> Export.then(f=>f.call(this,'statistics/labSingleTestResultDetail'))
		})
	}
}

export default Index